package com.indusfo.spc.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.indusfo.spc.pojo.AssociTion;
import com.indusfo.spc.service.AssocitionService;
import com.indusfo.spc.vo.JSONObject;
/**
 * 数据授权控制器
 *
 * @author 贺闻博
 * 
 *   2018年11月30日
 */
@Controller
@RequestMapping("assocition")
public class AsscoitionController {
	   @Resource
	   private AssocitionService associtionService;
	     /**
	      * 查询数据权限单条
	      * @param associTion
	      * @return
	      */
	   @RequestMapping(value="selectAssociTion")
	   @ResponseBody
	   public JSONObject selectAssociTion(AssociTion associTion){
		   JSONObject  ListAssocition = associtionService.selectAssociTion(associTion);
		   return ListAssocition;
	   }
	   
	   /**
	      * 更新数据权限
	      * @param associTion
	      * @return
	      */
	   @RequestMapping(value="updateAssociTion")
	   @ResponseBody
	   public JSONObject updateAssociTion(AssociTion associTion){
		   JSONObject  ListAssocition =  associtionService.updateAssociTion(associTion);
		   return ListAssocition;
	   }
	   
	   /**
	      * 新增数据权限
	      * @param associTion
	      * @return
	      */
	   @RequestMapping(value="insertAssociTion")
	   @ResponseBody
	   public JSONObject insertAssociTion(AssociTion associTion){
		   JSONObject  ListAssocition = associtionService.insertAssociTion(associTion);
		   return ListAssocition;
	   }
	   
	   /**
	      * 删除数据权限
	      * @param lDepId lRoleId lDataState
	      * @return
	      */
	   @RequestMapping(value="deleteAssociTion")
	   @ResponseBody
	   public JSONObject deleteAssociTion(Long[] lDepId,Integer lRoleId,Integer lDataState){
		   JSONObject  ListAssocition = associtionService.deleteAssociTion(lDepId, lRoleId, lDataState);
		   return ListAssocition;
	   }
	   /**
	      * 删除数据权限
	      * @param lRoleId
	      * @return
	      */
	   @RequestMapping(value="deleteAssociTionAll")
	   @ResponseBody
	   public JSONObject deleteAssociTionAll(Integer lRoleId){
		   JSONObject  ListAssocition = associtionService.deleteAssociTionAll(lRoleId);
		   return ListAssocition;
	   }
	   
}
